//
//  SpreadCityCellModel.m
//  EnvironmentalProtection
//
//  Created by HCreater on 2018/12/24.
//  Copyright © 2018年 HCreater. All rights reserved.
//

#import "SpreadCityCellModel.h"

#import "SpreadCityListData.h"

@interface SpreadCityCellModel ()

@property (nonatomic, readwrite, copy) NSString* cityName;
@property (nonatomic, readwrite, copy) NSString* endTime;

@end

@implementation SpreadCityCellModel

- (instancetype)initWithData:(id)data cellHeight:(CGFloat)cellHeight
{
    self = [super init];
    if (self)
    {
        _data = data;
        
        /// cellHeight+2（2容错）
        _cellHeight = MHUIScaleValue(cellHeight)+2;
        
        @weakify(self);
        SpreadCityListData* spreadCityListData = data;
        
        self.cityName = spreadCityListData.areaName;
        self.endTime = HCStrFormat(@"到期时间：%@", spreadCityListData.endTime);
        self.xfCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
            return [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
                [subscriber sendNext:spreadCityListData];
                [subscriber sendCompleted];
                
                return nil;
            }];
        }];
    }
    
    return self;
}

@end
